<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('日期和时间')"/>
    <th:block th:include="include :: datetimepicker-css"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="role-form">
                <div class="select-list">
                    <ul>

                        <li>
                            工单号：<input type="text" name="orderId" style="width: 100px"/>
                        </li>
                        <li>
                            客户姓名：<input type="text" name="customerName " style="width: 100px"/>
                        </li>
                        <li>
                            客户电话：<input type="text" name="customerPhone"/>
                        </li>
                        <li>
                            客户联系人：<input type="text" name="customerLinkman"/>
                        </li>

                        <li>
                            技术员姓名：<input type="text" name="workerName" style="width: 100px"/>
                        </li>
                        <li>创建时间</li>
                        <li >
                            <input type="text" class="form-control" name="orderStartTime" id="startTime" placeholder="yyyy-MM-dd HH:mm:ss">
                        </li>

                        <li >
                            <input type="text" class="form-control" name="orderEndTime" id="endTime" placeholder="yyyy-MM-dd HH:mm:ss">
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-warning" onclick="$.table.exportExcel()">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<script th:inline="javascript">
    var prefix = ctx + "check";
    var shenhe = [[${@permission.hasPermi('order:shenhe')}]];
    var comment = [[${@permission.hasPermi('order:comment')}]];

    $(function () {
        $("#startTime").datetimepicker({
            format: "yyyy-mm-dd hh:ii:ss",
            autoclose: true
        });
        $("#endTime").datetimepicker({
            format: "yyyy-mm-dd hh:ii:ss",
            autoclose: true
        });

        var options = {
            url:  "/order/list/1",
            createUrl: prefix + "/add",
            updateUrl: "order/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: "/order/export",
            detailUrl: "/order/detail/{id}",
            modalName: "工单",
            columns: [{
                checkbox: true
            },
                {
                    field: 'orderId',
                    title: '工单ID'
                },
                {
                    field: 'orderCreateTime',
                    title: '创建时间',
                    sortable: false
                },
                {
                    field: 'orderStartTime',
                    title: '规定开始时间',
                    sortable: false
                },
                {
                    field: 'orderEndTime',
                    title: '规定结束时间',
                    sortable: false
                },
                {
                    field: 'typeName',
                    title: '类型',
                    sortable: false
                },
                {
                    field: 'orderTitle',
                    title: '标题',
                    sortable: false
                },
                {
                    field: 'customer',
                    title: '客户信息',
                    sortable: false
                },
                {
                    field: 'customerLinkman',
                    title: '客户联系人',
                    sortable: false
                },
                {
                    field: 'publisher',
                    title: '发布者',
                    sortable: false
                },
                {
                    field: 'worker',
                    title: '承接人',
                    sortable: false
                },
                {
                    field: 'orderMoney',
                    title: '金额',
                    sortable: false
                },
                {
                    field: 'orderStatus',
                    title: '工单状态',
                    sortable: false
                },
                {
                    field: 'checkStatus',
                    title: '审核状态',
                    sortable: false
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-info btn-xs ' + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.orderId + '\')"><i class="fa fa-info"></i>详情</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });


    function commentOrder(id) {
        layer.prompt({title: '请输入评价', formType: 2}, function (text, index) {
            layer.close(index);
            $.operate.post("check/comment",
                {
                    id: id,
                    comment: text
                }
            )
        });
    }

    /* 添加用户-选择用户-提交 */
    function submitHandler() {
        var rows = $.table.selectFirstColumns();
        if (rows.length == 0) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }

        alert(rows.join());
    }

</script>
</body>
</html>